function filterData(data, val) {
    let s_data = [];
    for (let i = 0; i < data.length; i++) {
        if (data[i].teacher.indexOf(val) !== -1) {
            s_data.push(data[i])
        }
    }

    if (s_data.length !== 0) {
        return s_data;
    }else {
        for (let i = 0; i < data.length; i++) {
            if (data[i].course.indexOf(val) !== -1) {
                s_data.push(data[i])
            }
        }
        console.log(s_data)

        return s_data;
    }
}

function setChartData(data, condition) {
    let n_data = [];

    data.forEach((item, idx) => {
        n_data[idx] = item[condition]
    })

    return n_data;
}

export {
    filterData,
    setChartData
}